//#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#include <unistd.h>

int main()
{
    pid_t id =fork();
    if(id==0)
    {
        //is child
        while(true)
        {
            cout<<"i am child, pid: "<<getpid()<<" # my father pid is:  "<<getppid()<<'\n';
            sleep(1);
        }

    }
    if(id>0)
    {
        //is father
        while(true)
        {
            cout<<"i am father, pid: "<<getpid()<<" # my child pid is: "<<id<<'\n';
            sleep(2);
        }
    }

    sleep(1);

    return 0;
}

